﻿using System;
using System.Diagnostics;
using TI_BLE_HCI_ClientLib.HCIBaseEntities;
using TI_BLE_HCI_ClientLib.HCIEvents;
using Utilities;

namespace TI_BLE_HCI_ClientLib.HCIParsers
{
    public static partial class HCIEventParser
    {
        private static HCIEvent parseHCI_LE_ExtEvent_GAP_Make_Discoverable_Done(byte parsLen, byte[] buffer)
        {
            if (parsLen != 5) throw new ArgumentException("parseHCI_LE_ExtEvent_GAP_LinkTerminated Parameters Length != 5");
            byte bufIdx = 4;

            HCIVendorSpecificEventHostErrorCode status = (HCIVendorSpecificEventHostErrorCode)parseByteParameter(buffer, ref bufIdx);
            ushort interval = parseWordParameter(buffer, ref bufIdx);
            
            var hciEvent = new HCIEvent_GAP_Make_Discoverable_Done(status, interval);

            return hciEvent;
        }
    }
}
